﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Skynet.WebAdministracion.Views.CategoriesMgm;
using Microsoft.Practices.Unity;

namespace Skynet.WebSite.Administracion
{
    public partial class CategoriesMgmView : Skynet.WebFoundation.Views.Page , ICategoriesMgmView
    {
        private CategoriesMgmPresenter _Presenter;
        [Dependency]
        public CategoriesMgmPresenter Presenter
        {
            get { return _Presenter; }
            set
            {
                
                _Presenter = value;
                this._Presenter.View = this;
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {            
            
            this.ocdsCategories.ObjectCreating += delegate(object ocds, ObjectDataSourceEventArgs args) { args.ObjectInstance = this.Presenter; };
            this.ocdsWorkCategory.ObjectCreating += delegate(object ocds, ObjectDataSourceEventArgs args) { args.ObjectInstance = this.Presenter; };
            this.dvCategory.EnableDynamicData(typeof(Skynet.BusinessEntities.ExamCategory));
            this.gvCategories.EnableDynamicData(typeof(Skynet.BusinessEntities.ExamCategory));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            
            if (!this.IsPostBack)
            {
                this.Presenter.OnViewInitialized();
            }
            this.Presenter.OnViewLoaded();            
        }

        protected void gvCategories_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.dvCategory.ChangeMode(DetailsViewMode.Edit);            
        }
    }
}